﻿@model CampWeek5__Book_Project_.Models.AuthorVM

@{
    ViewBag.Title = "CreateAuthor";
}

<h2>Edit Author Details</h2>

<form class="well container" method="post">
    @*@Html.HiddenFor(x => x.Id)*@
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                @Html.LabelFor(x => x.AuthorName)
                @Html.TextBoxFor(x => x.AuthorName, new { @class = "form-control", placeholder = "Enter author full name" })
                <br />
                @Html.LabelFor(x => x.DateOfBirth)
                <input name="DateOfBirth" class="form-control" placeholder="mm/dd/yyyy" data-val="true" data-val-date="You must enter a Date for the Date of Birth." value="@Model.DateOfBirth.ToString("MM/dd/yyyy")" />
                <br />
                @Html.LabelFor(x => x.DateOfDeath)
                @if (@Model.DateOfDeath.HasValue == false)
                { 
                <input name="DateOfDeath" class="form-control" placeholder="mm/dd/yyyy" />
                }
                else
                {
                    <input name="DateOfDeath" class="form-control" placeholder="mm/dd/yyyy" value="@Model.DateOfDeath.Value.ToString("MM/dd/yyyy")" />
                }
                @*@Html.TextBoxFor(x => x.DateOfDeath, new { @class = "form-control", placeholder = "mm/dd/yyyy or leave blank" })*@

                <br />
                @Html.LabelFor(x => x.AuthorCountry)
                @Html.TextBoxFor(x => x.AuthorCountry, new { @class = "form-control", placeholder = "Enter author's country of residence" })
                <br />
                @Html.LabelFor(x => x.AuthorImg)
                @Html.TextAreaFor(x => x.AuthorImg, new { @class = "form-control wide", placeholder = "paste url for author's image here" })
                <br />
                @Html.LabelFor(x => x.AuthorBio)
                @Html.TextAreaFor(x => x.AuthorBio, new { @class = "form-control wide", placeholder = "Author bio goes here" })
                <br />
                @Html.LabelFor(x => x.Tags)
                <input class="form-control" name="Tags" placeholder="Enter Genre(s) seperated by commas" value="@string.Join(", ", Model.Tags)" />
                <br />
            </div>
        </div>
    </div>

    <div>
        <button type="submit" class="btn btn-primary">Submit</button>
    </div>

    @Html.ValidationSummary("", new { style = "color:red;" })


</form>

